<!DOCTYPE html>
<html>
<head>
<title>系统设置</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/AdminLTE.min.css">
<link rel="stylesheet" href="../../css/font-awesome.min.css">
<link rel="stylesheet" href="../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
<link rel="stylesheet" href="../../plugins/ztree/css/metroStyle/metroStyle.css">
<link rel="stylesheet" href="../../css/all-skins.min.css">
<link rel="stylesheet" href="../../plugins/jqfileupload/css/jquery.fileupload.css">
<link rel="stylesheet" href="../../css/main.css">
<script src="../../libs/jquery.min.js"></script>
<script src="../../plugins/layer/layer.js"></script>
<script src="../../libs/bootstrap.min.js"></script>
<script src="../../libs/vue.min.js"></script>
<script src="../../plugins/jqfileupload/js/vendor/jquery.ui.widget.js"></script>
<script src="../../plugins/jqfileupload/js/jquery.iframe-transport.js"></script>
<script src="../../plugins/jqfileupload/js/jquery.fileupload.js"></script>
<script src="../../plugins/jqgrid/grid.locale-cn.js"></script>
<script src="../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="../../plugins/ztree/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=7570HwPBQyVdHl8GsG8TDf7zVmgczMKH"></script>
<script src="../../js/components.js"></script>
<script src="../../libs/app.js"></script>
<script src="../../js/common.js"></script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div id="rrapp" class="wrapper" v-cloak>
  <main-header></main-header>
  <main-sidebar></main-sidebar>
  <!-- =============================================== -->
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <content-header title="系统设置"></content-header>

    <!-- Main content -->
    <section class="content">
    <div v-show="!showList">
		<div class="box">
			<div class="box-header with-border">
              <h3 class="box-title">{{title}}</h3>
            </div><!-- /.box-header -->
            <div class="box-body">
				<form class="form-horizontal">
					<div class="form-group">
					   	<div class="col-sm-2 control-label">LOGO</div>
					   	<div class="col-sm-7">
					        <!-- The fileinput-button span is used to style the file input field as button -->
						    <span class="btn btn-success fileinput-button">
						        <i class="glyphicon glyphicon-plus"></i>
						        <span>选择图片...</span>
						        <!-- The file input field used as target for the file upload widget -->
						        <input id="fileupload" type="file" name="file" multiple>
						    </span>
						    <br>
						    <br>
						    <!-- The container for the uploaded files -->
						    <div id="files" class="files">
						    	<div>
						    		<img alt="" width="200px" :src="settings.logo">
						    	</div>
						    </div>
					    </div>
					</div>
				
					<div class="form-group">
					   	<div class="col-sm-2 control-label">系统名称</div>
					   	<div class="col-sm-7">
					      <input type="text" class="form-control" v-model="settings.projectName" placeholder="系统名称"/>
					    </div>
					</div>
					<div class="form-group">
					   	<div class="col-sm-2 control-label">联系电话</div>
					   	<div class="col-sm-7">
					      <input type="text" class="form-control" v-model="settings.telephone" placeholder="联系电话"/>
					    </div>
					</div>
					<div class="form-group">
					   	<div class="col-sm-2 control-label">地点</div>
					   	<div class="col-sm-7">
					      <input type="text" class="form-control" v-model="settings.address" placeholder="地点" @blur="searchMap"/>
					    </div>
					</div>
					
					<div class="form-group">
						<div class="col-sm-2 control-label">坐标</div>
					   	<div class="col-sm-7">
							<div id="allmap" style="height: 400px"></div>
						</div>
					</div>
					<div class="box-footer">
						<div class="col-sm-2 control-label"></div> 
						<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
					</div>
				</form>
			</div>
		</div>
	</div>
	</section>
	</div>
</div>

<script src="../../js/modules/oms/settings.js"></script>
<script type="text/javascript">
$(function(){
	// Change this to the location of your server-side upload handler:
    var url = "/api/fileupload/upload";
    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {
            if(data.result.code == 0){
            	vm.settings.logo = data.result.url;
            }
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
})

// 百度地图API功能
var map = new BMap.Map("allmap");    // 创建Map实例
map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);  // 初始化地图,设置中心点坐标和地图级别
//添加地图发布权限控件
map.addControl(new BMap.MapTypeControl({
	mapTypes:[
        BMAP_NORMAL_MAP,
        BMAP_HYBRID_MAP
    ]}));	  
map.setCurrentCity("北京");          // 设置地图显示的城市 此项是必须设置的
map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
function showInfo(e){
	//alert(e.point.lng + ", " + e.point.lat);
	var marker = new BMap.Marker(new BMap.Point(e.point.lng, e.point.lat)); // 创建点
	vm.settings.lng = e.point.lng;
	vm.settings.lat = e.point.lat;
	map.clearOverlays();
	map.addOverlay(marker);            //增加点
}
map.addEventListener("click", showInfo);
var local = new BMap.LocalSearch(map, {
	renderOptions:{map: map}
});

</script>

</body>
</html>